class ArrayInsert {
  constructor(capacity = 1) {
    this.arr = new Array(capacity);
  }

  push(item) {
    this.arr.push(item);
  }
  /**
   * 中间插入
   * item 插入的元素
   * ind 插入的为自豪
   * **/
  insert(item, ind) {
    for (let i = this.size - 1; i >= ind; i--) {
      this.arr[i+1] = this.arr[i];
    }
    this.arr[ind] = item;
    this.size++;
    return this.arr;
  }
}
let arrayInsert = new ArrayInsert(10);
console.log(arrayInsert.insert('b', 1))
console.log(arrayInsert.insert('e', 4))
console.log(arrayInsert.insert('c', 2))
console.log(arrayInsert.insert('a', 0))
console.log(arrayInsert.insert('d', 3))
